package com.yanqu.road.entity.activity.foxcard.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_fox_lottery_settle")
public class FoxCardLotterySettleConfig {
    @FieldTypeAnnotation(select = true, orderASC = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "类型")
    private int type;
    @FieldTypeAnnotation(desc = "参数")
    private String param;
    @FieldTypeAnnotation(desc = "抽奖类型, 0 必须继续 1 自由选择 2 停止")
    private int rollType;
    @FieldTypeAnnotation(desc = "选择类型;可选数量;积分倍率")
    private String reward;
    @FieldTypeAnnotation(desc = "名称")
    private String name;
    @FieldTypeAnnotation(desc = "描述")
    private String desc;

    private List<Integer> params = new ArrayList<>();
    private List<Integer> rewards = new ArrayList<>();

    public FoxCardLotterySettleConfig(ResultSet rs) throws SQLException {
        this.activityId = rs.getInt("activityId");
        this.id = rs.getInt("id");
        this.type = rs.getInt("type");
        this.param = rs.getString("param");
        this.rollType = rs.getInt("rollType");
        this.reward = rs.getString("reward");
        this.name = rs.getString("name");
        this.desc = rs.getString("desc");

        this.params = StringUtils.stringToIntegerList(this.param, "\\|");
        this.rewards = StringUtils.stringToIntegerList(this.reward, "\\|");
    }

    public int getActivityId() {
        return activityId;
    }

    public int getId() {
        return id;
    }

    public int getType() {
        return type;
    }

    public String getParam() {
        return param;
    }

    public int getRollType() {
        return rollType;
    }

    public String getReward() {
        return reward;
    }

    public List<Integer> getParams() {
        return params;
    }

    public List<Integer> getRewards() {
//        奖励(选择类型;可选数量;积分倍率)
//        0 不可选
//        1 随机
//        2 自选
        return rewards;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }
}
